package com.partyjoin.project.module.prepareEvolve.service;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.partyjoin.common.utils.StringUtils;
import com.partyjoin.project.module.prepareEvolve.mapper.PrepareEvolveMapper;
import com.partyjoin.project.module.prepareEvolve.domain.PrepareEvolve;
import com.partyjoin.project.module.prepareEvolve.service.IPrepareEvolveService;
import com.partyjoin.common.support.Convert;

/**
 * 发展预备党员记录 服务层实现
 * 
 * @author 莫东林
 * @date 2018-07-19
 */
@Service
public class PrepareEvolveServiceImpl implements IPrepareEvolveService 
{
	@Autowired
	private PrepareEvolveMapper prepareEvolveMapper;

	/**
     * 查询发展预备党员记录信息
     * 
     * @param prepareEvolveId 发展预备党员记录ID
     * @return 发展预备党员记录信息
     */
    @Override
	public PrepareEvolve selectPrepareEvolveById(Integer prepareEvolveId)
	{
	    return prepareEvolveMapper.selectPrepareEvolveById(prepareEvolveId);
	}
	
	/**
     * 查询发展预备党员记录列表
     * 
     * @param prepareEvolve 发展预备党员记录信息
     * @return 发展预备党员记录集合
     */
	@Override
	public List<PrepareEvolve> selectPrepareEvolveList(PrepareEvolve prepareEvolve)
	{
	    return prepareEvolveMapper.selectPrepareEvolveList(prepareEvolve);
	}
	
    /**
     * 新增发展预备党员记录
     * 
     * @param prepareEvolve 发展预备党员记录信息
     * @return 结果
     */
	@Override
	public int insertPrepareEvolve(PrepareEvolve prepareEvolve)
	{
	    return prepareEvolveMapper.insertPrepareEvolve(prepareEvolve);
	}
	
	/**
     * 修改发展预备党员记录
     * 
     * @param prepareEvolve 发展预备党员记录信息
     * @return 结果
     */
	@Override
	public int updatePrepareEvolve(PrepareEvolve prepareEvolve)
	{
	    return prepareEvolveMapper.updatePrepareEvolve(prepareEvolve);
	}
	
	/**
     * 保存发展预备党员记录
     * 
     * @param prepareEvolve 发展预备党员记录信息
     * @return 结果
     */
	@Override
	public int savePrepareEvolve(PrepareEvolve prepareEvolve)
	{
	    Integer prepareEvolveId = prepareEvolve.getPrepareEvolveId();
		int rows = 0;
		if (StringUtils.isNotNull(prepareEvolveId))
        {
		    rows = prepareEvolveMapper.updatePrepareEvolve(prepareEvolve);
		}
		else
        {
		    rows = prepareEvolveMapper.insertPrepareEvolve(prepareEvolve);
		}
		return rows;
	}
	
	/**
     * 删除发展预备党员记录对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	public int deletePrepareEvolveByIds(String ids)
	{
		return prepareEvolveMapper.deletePrepareEvolveByIds(Convert.toStrArray(ids));
	}

	/**
	 * 备案下拉获取通过的预审记录(最后组装返回预审通过的会议)
	 */
	@Override
	public List<PrepareEvolve> selectPassExamine(PrepareEvolve prepareEvolve) {
		return prepareEvolveMapper.selectPassExamine(prepareEvolve);
	}

	/**
     * 获取党委会议所需的预备党员培养记录
     */
	@Override
	public List<PrepareEvolve> selectPrepareEvolveToConference(PrepareEvolve prepareEvolve) {
		return prepareEvolveMapper.selectPrepareEvolveToConference(prepareEvolve);
	}
	
}
